package chapter01.v5;

/**
 * 影片
 * 
 * @author buxingdeyu
 *
 */
public class Movie {

	public static final int CHILDRENS = 2; // 儿童片

	public static final int REGULAR = 0; // 普通片

	public static final int NEW_RELEASE = 1; // 新片

	private String _title;

	private Price _price;

	public Movie(String _title, int _priceCode) {
		super();
		this._title = _title;
		setPriceCode(_priceCode);
	}

	private void setPriceCode(int _priceCode) {
		switch (_priceCode) {
		case REGULAR:
			_price = new RegularPrice();
			break;
		case CHILDRENS:
			_price = new ChildrenPrice();
			break;
		case NEW_RELEASE:
			_price = new NewReleasePrice();
			break;
		default:
			throw new IllegalArgumentException("Incorrect Price Code");
		}

	}

	public String getTitle() {
		return _title;
	}

	public void setTitle(String _title) {
		this._title = _title;
	}

	double getCharge(int daysRented) {
		return _price.getCharge(daysRented);
	}

	int getFrequentRenterPoints(int daysRented) {
		return _price.getFrequentRenterPoints(daysRented);

	}

}
